﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProjectBuilder
{
    public static class ObjectExtension
    {
        public static T getAttribute<T>(this object oObj) where T : Attribute
        {
            return oObj.GetType().getAttribute<T>();
        }

        public static T getAttribute<T>(this Type type) where T : Attribute
        {
            var attrs = type.GetCustomAttributes(typeof(T), true);
            return (attrs.Length == 0) ? null : attrs[0] as T;
        }
    }
}
